package kr.saeildamil.androidstudy_second.fragment.common;

import kr.saeildamil.androidstudy_second.R;
import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CounterFragment01 extends Fragment {
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		  View root = inflater.inflate(R.layout.ch20_counterfragment,
		  container);
		 
		 final TextView textCounter = (TextView) root
		  .findViewById(R.id.counterfragment_txtcounter);
		 
		 root.findViewById(R.id.counterfragment_btn).setOnClickListener( new
		 OnClickListener() { 
	public void onClick(View v) { int count =
		 Integer.parseInt(textCounter.getText() .toString());
		 textCounter.setText(Integer.toString(count + 1)); } });
		 
		 return root;
	}
}
